package org.zcn.xmlg_backend.entity;



import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

// 统一响应  data 帮你生成getter和setter方法 toString ,hashCode ,equals方法
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Result<T> success(T data) {
        return new Result<>(1, "操作成功", data);
    }

    public static <T> Result<T> success() {
        return new Result<>(1, "操作成功", null);
    }
    public static <T> Result<T> error(String msg) {
        return new Result<>(0, msg, null);
    }
}
